import React, { Component } from 'react'
import { Result } from 'antd';
import { Link } from 'react-router-dom';

export default class NotFind extends Component {
    state = {
        time: 5
    }
    componentDidMount() {
        const timer = setInterval(() => {
            let { time } = this.state
            time -= 1;
            this.setState({
                time
            })
            if (time === 0) {
                clearInterval(timer);
                window.location.href = '/login'
            }
        }, 1000);

    }
    render() {
        const { time } = this.state
        return (
            <Result
            status="404"
            title="404"
            subTitle={`抱歉，您访问的页面不存在！${time}秒后跳转到登录页面`}
            extra={<Link to='/login'>返回登录页面</Link>}
          />
        )
    }
}
